home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / intro.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  36.0 KB  |  873 lines

  1. *intro.txt*     For Vim version 6.0.  Last change: 2001 Sep 04
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Introduction to Vim                    *ref* *reference*
  8.  
  9. 1. Introduction            |intro|
  10. 2. Vim on the internet        |internet|
  11. 3. Credits            |credits|
  12. 4. Notation            |notation|
  13. 5. Modes, introduction        |vim-modes-intro|
  14. 6. Switching from mode to mode    |mode-switching|
  15. 7. The window contents        |window-contents|
  16. 8. Definitions            |definitions|
  17.  
  18. ==============================================================================
  19. 1. Introduction                        *intro*
  20.  
  21. Vim stands for Vi IMproved.  It used to be Vi IMitation, but there are so many
  22. improvements that a name change was appropriate.  Vim is a text editor which
  23. includes almost all the commands from the Unix program "Vi" and a lot of new
  24. ones.  It is very useful for editing programs and other plain text.
  25.    All commands are given with the keyboard.  This has the advantage that you
  26. can keep your fingers on the keyboard and your eyes on the screen.  For those
  27. who want it, there is mouse support and a GUI version with scrollbars and
  28. menus (see |gui.txt|).
  29.  
  30. An overview of this manual can be found in the file "help.txt", |help.txt|.
  31. It can be accessed from within Vim with the <Help> or <F1> key and with the
  32. |:help| command (just type ":help", without the bars or quotes).
  33.    The 'helpfile' option can be set to the name of the help file, in case it
  34. is not located in the default place.  You can jump to subjects like with tags:
  35. Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.
  36.  
  37. Throughout this manual the differences between Vi and Vim are mentioned in
  38. curly braces, like this: {Vi does not have on-line help}.  See |vi_diff.txt|
  39. for a summary of the differences between Vim and Vi.
  40.  
  41. This manual refers to Vim on various machines.  There may be small differences
  42. between different computers and terminals.  Besides the remarks given in this
  43. document, there is a separate document for each supported system, see
  44. |sys-file-list|.
  45.  
  46. This manual is a reference for all the Vim commands and options.  This is not
  47. an introduction to the use of Vi or Vim, it gets a bit complicated here and
  48. there.  For beginners, there is a hands-on |tutor|.  To learn using Vim, read
  49. the user manual |usr_toc.txt|.
  50.  
  51.                             *book*
  52. There are many books on Vi that contain a section for beginners.  There are
  53. two books I can recommend:
  54.  
  55.     "Vim - Vi Improved" by Steve Oualline
  56.  
  57. This is the very first book completely dedicated to Vim.  It is very good for
  58. beginners.  The most often used commands are explained with pictures and
  59. examples.  The less often used commands are also explained, the more advanced
  60. features are summarized.  There is a comprehensive index and a quick
  61. reference.  Parts of this book have been included in the user manual
  62. |frombook|.
  63. Published by New Riders Publishing.  ISBN: 0735710015
  64. For more information try one of these:
  65.     http://vim.iccf-holland.org
  66.     http://www.vim.org/iccf/click5.html
  67.  
  68.     "Learning the Vi editor" by Linda Lamb and Arnold Robbins
  69.  
  70. This is a book about Vi that includes a chapter on Vim (in the sixth edition).
  71. The first steps in Vi are explained very well.  The commands that Vim adds are
  72. only briefly mentioned.  There is also a German translation.
  73. Published by O'Reilly.  ISBN: 1-56592-426-6.
  74.  
  75. ==============================================================================
  76. 2. Vim on the internet                    *internet*
  77.  
  78.             *www* *faq* *FAQ* *ftp* *distribution* *download*
  79. The Vim pages contain the most recent information about Vim.  They also
  80. contain links to the most recent version of Vim.  The FAQ is a list of
  81. Frequently Asked Questions.  Read this if you have problems.
  82.  
  83.     VIM home page:      http://vim.sf.net/
  84.     Sven's VIM pages: http://www.vim.org/
  85.     Latest news:      http://www.vim.org/news.html
  86.     VIM FAQ:      http://www.vim.org/faq/
  87.     Downloading:      ftp://ftp.vim.org/pub/vim/MIRRORS
  88.  
  89.  
  90. Usenet News group where Vim is discussed:        *news* *usenet*
  91.     comp.editors
  92. See http://www.vim.org/usenet.html.  This group is also for other editors.  If
  93. you write about Vim, don't forget to mention that.
  94.  
  95.                         *mail-list* *maillist*
  96. There are several mailing lists for Vim:
  97. <vim@vim.org>
  98.     For discussions about using existing versions of Vim: Useful mappings,
  99.     questions, answers, where to get a specific version, etc.
  100. <vim-dev@vim.org>                *vim-dev* *vimdev*
  101.     For discussions about changing Vim: New features, porting, patches,
  102.     beta-test versions, etc.
  103. <vim-announce@vim.org>                *vim-announce*
  104.     Announcements about new versions of Vim; also for beta-test versions
  105.     and ports to different systems.
  106. <vim-multibyte@vim.org>                *vim-multibyte*
  107.     For discussions about using and improving the multi-byte aspects of
  108.     Vim.
  109. <vim-mac@vim.org>                *vim-mac*
  110.     For discussions about using and improving the Macintosh version of
  111.     Vim.
  112.  
  113. See http://www.vim.org/mail.html.
  114.  
  115. NOTE:
  116. - You can only send messages to these lists if you have subscribed!
  117. - You need to send the messages from the same location as where you subscribed
  118.   from (to avoid spam mail).
  119. - Maximum message size is 40000 characters.
  120.  
  121.                         *subscribe-maillist*
  122. If you want to join, send a message to
  123.     <vim-help@vim.org>
  124. Make sure that your "From:" address is correct.  Then the list server will
  125. give you help on how to subscribe.
  126.  
  127. You can retrieve old messages from the maillist software, and an index of
  128. messages.  Ask vim-help for instructions.
  129.  
  130. Archives are kept at:                *maillist-archive*
  131. http://groups.yahoo.com/group/vim
  132. http://groups.yahoo.com/group/vimdev
  133. http://groups.yahoo.com/group/vimannounce
  134. http://groups.yahoo.com/group/vim-multibyte
  135. http://groups.yahoo.com/group/vim-mac
  136.  
  137. Another archive is at http://www.somelist.com in the "Editeurs" section (the
  138. site is in French, the messages are in English).
  139.  
  140.  
  141. Additional maillists:
  142.  
  143. <vim-fr@club.voila.fr>                *french-maillist*
  144.     Vim list in the French language.  Subscribe by sending a message to
  145.         <vim-fr-subscribe@club.voila.fr>
  146.     Or go to http://groups.yahoo.com/group/vim-fr.
  147.  
  148.  
  149. Bug reports:                *bugs* *bug-reports* *bugreport.vim*
  150.  
  151. Send bug reports to: Vim bugs <bugs@vim.org>
  152. This is not a maillist but the message is redirected to the Vim maintainer.
  153. Please be brief; all the time that is spend on answering mail is subtracted
  154. from the time that is spent on improving Vim!  Always give a reproducible
  155. example and try to find out which settings or other things influence the
  156. appearance of the bug.  Try different machines, if possible.  Send me patches
  157. if you can!
  158.  
  159. In case of doubt, use: >
  160.    :so $VIMRUNTIME/bugreport.vim
  161. This will create a file "bugreport.txt" in the current directory, with a lot
  162. of information of your environment.  Before sending this out, check if it
  163. doesn't contain any confidential information!
  164.  
  165.                             *debug-vim*
  166. When Vim crashes in one of the test files, and you are using gcc for
  167. compilation, here is what you can do to find out exactly where Vim crashes:
  168.  
  169. 1. Compile Vim with the "-g" option (there is a line in the Makefile for this,
  170.    which you can uncomment).
  171.  
  172. 2. Execute these commands (replace "11" with the test that fails): >
  173.     cd testdir
  174.     gdb ../vim
  175.     run -u unix.vim -U NONE -s dotest.in test11.in
  176.  
  177. 3. Check where Vim crashes, gdb should give a message for this.
  178.  
  179. 4. Get a stack trace from gdb with this command: >
  180.     where
  181. <  You can check out different places in the stack trace with: >
  182.     frame 3
  183. <  Replace "3" with one of the numbers in the stack trace.
  184.  
  185.                             *year-2000* *Y2K*
  186. Since Vim internally doesn't use dates for editing, there is no year 2000
  187. problem to worry about.  Vim does use the time in the form of seconds since
  188. January 1st 1970.  It is used for a time-stamp check of the edited file and
  189. the swap file, which is not critical and should only cause warning messages.
  190.  
  191. There might be a year 2038 problem, when the seconds don't fit in a 32 bit int
  192. anymore.  This depends on the compiler, libraries and operating system.
  193. Specifically, time_t and the ctime() function are used.  And the time_t is
  194. stored in four bytes in the swap file.  But that's only used for printing a
  195. file date/time for recovery, it will never affect normal editing.
  196.  
  197. The Vim strftime() function directly uses the strftime() system function.
  198. localtime() uses the time() system function.  getftime() uses the time
  199. returned by the stat() system function.  If your system libraries are year
  200. 2000 compliant, Vim is too.
  201.  
  202. The user may create scripts for Vim that use external commands.  These might
  203. introduce Y2K problems, but those are not really part of Vim itself.
  204.  
  205. ==============================================================================
  206. 3. Credits                        *credits* *author*
  207.  
  208. Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
  209.  
  210. Parts of the documentation come from several Vi manuals, written by:
  211.     W.N. Joy
  212.     Alan P.W. Hewett
  213.     Mark Horton
  214.  
  215. The Vim editor is based on Stevie and includes (ideas from) other software,
  216. worked on by the people mentioned here.  Other people helped by sending me
  217. patches, suggestions and giving feedback about what is good and bad in Vim.
  218.  
  219. Vim would never have become what it is now, without the help of these people!
  220.  
  221.     Ron Aaron        Win32 GUI changes
  222.     Zoltan Arpadffy        work on VMS port
  223.     Dany St-Amant        Macintosh port
  224.     Tony Andrews        Stevie
  225.     Gert van Antwerpen    changes for DJGPP on MS-DOS
  226.     Berkeley DB(3)        ideas for swap file implementation
  227.     Keith Bostic        Nvi
  228.     Walter Briscoe        Makefile updates, various patches
  229.     Ralf Brown        SPAWNO library for MS-DOS
  230.     Robert Colon        many useful remarks
  231.     Marcin Dalecki        GTK+ GUI port, toolbar icons, gettext()
  232.     Kayhan Demirel        sent me news in Uganda
  233.     Chris & John Downey    xvi (ideas for multi-windows version)
  234.     Henk Elbers        first VMS port
  235.     Eric Fischer        Mac port, 'cindent', and other improvements
  236.     Benji Fisher        Answering lots of user questions
  237.     Bill Foster        Athena GUI port
  238.     Loic Grenie        xvim (ideas for multi windows version)
  239.     Sven Guckes        Vim WWW page maintainer
  240.     Darren Hiebert        Exuberant ctags
  241.     Bruce Hunsaker        improvements for VMS port
  242.     Andy Kahn        Cscope support, GTK+ GUI port
  243.     Oezguer Kesim        Maintainer of Vim Mailing Lists
  244.     Steve Kirkendall    Elvis
  245.     Roger Knobbe        original port to Windows NT
  246.     Sergey Laskavy        Vim's help from Moscow
  247.     Felix von Leitner    Maintainer of Vim Mailing Lists
  248.     David Leonard        Port of Python extensions to Unix
  249.     Avner Lottem        Edit in right-to-left windows
  250.     Flemming Madsen        X11 client-server, various features and patches
  251.     MicroSoft        Gave me a copy of DevStudio to compile Vim with
  252.     Paul Moore        Python interface extensions, many patches
  253.     Katsuhito Nagano    Work on multi-byte versions
  254.     Sung-Hyun Nam        Work on multi-byte versions
  255.     Vince Negri        Win32 GUI and generic console enhancements
  256.     Steve Oualline        Author of the first Vim book |frombook|
  257.     George V. Reilly    Win32 port, Win32 GUI start-off
  258.     Stephen Riehm        bug collector
  259.     Stefan Roemer        various patches and help to users
  260.     Ralf Schandl        IBM OS/390 port
  261.     Olaf Seibert        DICE and BeBox version, regexp improvements
  262.     Mortaza Shiran        Farsi patches
  263.     Peter da Silva        termlib
  264.     Paul Slootman        OS/2 port
  265.     Henry Spencer        regular expressions
  266.     Tim Thompson        Stevie
  267.     G. R. (Fred) Walter    Stevie
  268.     Sven Verdoolaege    Perl interface
  269.     Robert Webb        Command-line completion, GUI versions, and
  270.                 lots of patches
  271.     Ingo Wilken        Tcl interface
  272.     Mike Williams        PostScript printing
  273.     Juergen Weigert        Lattice version, AUX improvements, UNIX and
  274.                 MS-DOS ports, autoconf
  275.     Stefan 'Sec' Zehl    Maintainer of vim.org
  276.  
  277. I wish to thank all the people that sent me bug reports and suggestions.  The
  278. list is too long to mention them all here.  Vim would not be the same without
  279. the ideas from all these people: They keep Vim alive!
  280.  
  281.  
  282. In this documentation there are several references to other versions of Vi:
  283.                             *Vi*
  284. Vi    "the original".  Without further remarks this is the version
  285.     of Vi that appeared in Sun OS 4.x.  ":version" returns
  286.     "Version 3.7, 6/7/85".  Sometimes other versions are referred
  287.     to.  Only runs under Unix.  Source code only available with a
  288.     license.  More information on Vi can be found through:
  289.         http://www.vim.org
  290.                             *Posix*
  291. Posix    From the IEEE standard 1003.2, Part 2: Shell and utilities.
  292.     Generally known as "Posix".  This is a textual description of
  293.     how Vi is supposed to work.
  294.     The version used is a draft from beginning 1996, so all remarks are
  295.     "expected to comply to" this.  Anything can change though...
  296.                             *Nvi*
  297. Nvi    The "New" Vi.  The version of Vi that comes with BSD 4.4 and FreeBSD.
  298.     Very good compatibility with the original Vi, with a few extensions.
  299.     The version used is 1.79.  ":version" returns "Version 1.79
  300.     (10/23/96)".  There has been no release the last few years, although
  301.     there is a development version 1.81.
  302.     Source code is freely available.
  303.                             *Elvis*
  304. Elvis    Another Vi clone, made by Steve Kirkendall.  Very compact but isn't
  305.     as flexible as Vim.
  306.     The version used is 2.1.  It is still being developed.  Source code is
  307.     freely available.
  308.  
  309. ==============================================================================
  310. 4. Notation                        *notation*
  311.  
  312. When syntax highlighting is used to read this, text that is not typed
  313. literally is often highlighted with the Special group.  These are items in [],
  314. {} and <>, and CTRL-X.
  315.  
  316. Note that Vim uses all possible characters in commands.  Sometimes the [], {}
  317. and <> are part of what you type, the context should make this clear.
  318.  
  319.  
  320. []        Characters in square brackets are optional.
  321.  
  322.                             *count* *[count]*
  323. [count]        An optional number that may precede the command to multiply
  324.         or iterate the command.  If no number is given, a count of one
  325.         is used, unless otherwise noted.  Note that in this manual the
  326.         [count] is not mentioned in the description of the command,
  327.         but only in the explanation.  This was done to make the
  328.         commands easier to look up.  If the 'showcmd' option is on,
  329.         the (partially) entered count is shown at the bottom of the
  330.         window.  You can use <Del> to erase the last digit (|N<Del>|).
  331.  
  332.                             *[quotex]*
  333. ["x]        An optional register designation where text can be stored.
  334.         See |registers|.  The x is a single character between 'a' and
  335.         'z' or 'A' and 'Z' or '"', and in some cases (with the put
  336.         command) between '0' and '9', '%', '#', ':' or '.'. The
  337.         uppercase and lowercase letter designate the same register,
  338.         but the lowercase letter is used to overwrite the previous
  339.         register contents, while the uppercase letter is used to
  340.         append to the previous register contents. Without the ""x" or
  341.         with """" the stored text is put into the unnamed register.
  342.  
  343.                             *{}*
  344. {}        Curly braces denote parts of the command which must appear,
  345.         but which can take a number of different values.  The
  346.         differences between Vim and Vi are also given in curly braces
  347.         (this will be clear from the context).
  348.  
  349.                             *{char1-char2}*
  350. {char1-char2}    A single character from the range char1 to char2.  For
  351.         example: {a-z} is a lowercase letter.  Multiple ranges may be
  352.         concatenated.  For example, {a-zA-Z0-9} is any alphanumeric
  353.         character.
  354.  
  355.                             *{motion}*
  356. {motion}    A command that moves the cursor.  These are explained in
  357.         |motion.txt|.  Examples:
  358.             w        to start of next word
  359.             4j        four lines down
  360.             /The<CR>    to next occurrence of "The"
  361.         This is used after an |operator| command to move over the text
  362.         that is to be operated upon.
  363.         - If the motion includes a count and the operator also had a
  364.           count, the two counts are multiplied.  For example: "2d3w"
  365.           deletes six words.
  366.         - The motion can also be a mouse click.  The mouse is not
  367.           supported in every terminal though.
  368.         - The ":omap" command can be used to map characters while an
  369.           operator is pending.
  370.         - Ex commands can be used to move the cursor.  This can be
  371.           used to call a function that does some complicated motion.
  372.           The motion is always characterwise exclusive, no matter
  373.           what ":" command is used.  This means it's impossible to
  374.           include the last character of a line without the line break
  375.           (unless 'virtualedit' is set).
  376.           If the Ex command changes the text before where the operator
  377.           start or jumps to another buffer the result is
  378.           unpredictable.  It is possible to change the text further
  379.           down.  Jumping to another buffer is possible if the current
  380.           buffer is not unloaded.
  381.  
  382.                             *{Visual}*
  383. {Visual}    A selected text area.  It is started with the "v", "V", or
  384.         CTRL-V command, then any cursor movement command can be used
  385.         to change the end of the selected text.
  386.         This is used before an |operator| command to highlight the
  387.         text that is to be operated upon.
  388.         See |Visual-mode|.
  389.  
  390.                             *<character>*
  391. <character>    A special character from the table below, optionally with
  392.         modifiers, or a single ASCII character with modifiers.
  393.  
  394.                             *'character'*
  395. 'c'        A single ASCII character.
  396.  
  397.                             *CTRL-{char}*
  398. CTRL-{char}    {char} typed as a control character; that is, typing {char}
  399.         while holding the CTRL key down.  The case of {char} does not
  400.         matter; thus CTRL-A and CTRL-a are equivalent.  But on some
  401.         terminals, using the SHIFT key will produce another code,
  402.         don't use it then.
  403.  
  404.                             *'option'*
  405. 'option'    An option, or parameter, that can be set to a value, is
  406.         enclosed in single quotes.  See |options|.
  407.  
  408.                             *quotecommandquote*
  409. "command"    A reference to a command that you can type is enclosed in
  410.         double quotes.
  411.  
  412.                     *key-notation* *key-codes* *keycodes*
  413. These names for keys are used in the documentation.  They can also be used
  414. with the ":map" command.
  415.  
  416. notation    meaning            equivalent    decimal value(s)    ~
  417. -----------------------------------------------------------------------
  418. <Nul>        zero            CTRL-@      0 (stored as 10) *<Nul>*
  419. <BS>        backspace        CTRL-H      8    *backspace*
  420. <Tab>        tab            CTRL-I      9    *tab* *Tab*
  421.                             *linefeed*
  422. <NL>        linefeed        CTRL-J     10 (used for <Nul>)
  423. <FF>        formfeed        CTRL-L     12    *formfeed*
  424. <CR>        carriage return        CTRL-M     13    *carriage-return*
  425. <Return>    same as <CR>                *<Return>*
  426. <Enter>        same as <CR>                *<Enter>*
  427. <Esc>        escape            CTRL-[     27    *escape* *<Esc>*
  428. <Space>        space                 32    *space*
  429. <lt>        less-than        <     60    *<lt>*
  430. <Bslash>    backslash        \     92    *backslash* *<Bslash>*
  431. <Bar>        vertical bar        |    124    *<Bar>*
  432. <Del>        delete                127
  433. <CSI>        command sequence intro  ALT-Esc 155    *<CSI>*
  434. <xCSI>        CSI when typed in the GUI        *<xCSI>*
  435.  
  436. <EOL>        end-of-line (can be <CR>, <LF> or <CR><LF>,
  437.         depends on system and 'fileformat')    *<EOL>*
  438.  
  439. <Up>        cursor-up            *cursor-up* *cursor_up*
  440. <Down>        cursor-down            *cursor-down* *cursor_down*
  441. <Left>        cursor-left            *cursor-left* *cursor_left*
  442. <Right>        cursor-right            *cursor-right* *cursor_right*
  443. <S-Up>        shift-cursor-up
  444. <S-Down>    shift-cursor-down
  445. <S-Left>    shift-cursor-left
  446. <S-Right>    shift-cursor-right
  447. <C-Left>    control-cursor-left
  448. <C-Right>    control-cursor-right
  449. <F1> - <F12>    function keys 1 to 12        *function_key* *function-key*
  450. <S-F1> - <S-F12> shift-function keys 1 to 12    *<S-F1>*
  451. <Help>        help key
  452. <Undo>        undo key
  453. <Insert>    insert key
  454. <Home>        home                *home*
  455. <End>        end                *end*
  456. <PageUp>    page-up                *page_up* *page-up*
  457. <PageDown>    page-down            *page_down* *page-down*
  458. <kHome>        keypad home (upper left)    *keypad-home*
  459. <kEnd>        keypad end (lower left)        *keypad-end*
  460. <kPageUp>    keypad page-up (upper right)    *keypad-page-up*
  461. <kPageDown>    keypad page-down (lower right)    *keypad-page-down*
  462. <kPlus>        keypad +            *keypad-plus*
  463. <kMinus>    keypad -            *keypad-minus*
  464. <kMultiply>    keypad *            *keypad-multiply*
  465. <kDivide>    keypad /            *keypad-divide*
  466. <kEnter>    keypad Enter            *keypad-enter*
  467. <kPoint>    keypad Decimal point        *keypad-point*
  468. <k0> - <k9>    keypad 0 to 9            *keypad-0* *keypad-9*
  469. <S-...>        shift-key            *shift* *<S-*
  470. <C-...>        control-key            *control* *ctrl* *<C-*
  471. <M-...>        alt-key or meta-key        *meta* *alt* *<M-*
  472. <A-...>        same as <M-...>            *<A-*
  473. <t_xx>        key with "xx" entry in termcap
  474. -----------------------------------------------------------------------
  475.  
  476. Note: The shifted cursor keys, the help key, and the undo key are only
  477. available on a few terminals.  On the Amiga, shifted function key 10 produces
  478. a code (CSI) that is also used by key sequences.  It will be recognized only
  479. after typing another key.
  480.  
  481. Note: There are two codes for the delete key.  127 is the decimal ASCII value
  482. for the delete key, which is always recognized.  Some delete keys send another
  483. value, in which case this value is obtained from the termcap entry "kD".  Both
  484. values have the same effect.  Also see |:fixdel|.
  485.  
  486. Note: The keypad keys are used in the same way as the corresponding "normal"
  487. keys.  For example, <kHome> has the same effect as <Home>.  If a keypad key
  488. sends the same raw key code as it non-keypad equivalent, it will be recognized
  489. as the non-keypad code.  For example, when <kHome> sends the same code as
  490. <Home>, when pressing <kHome> Vim will think <Home> was pressed.  Mapping
  491. <kHome> will not work then.
  492.  
  493.                                 *<>*
  494. Examples are often given in the <> notation.  Sometimes this is just to make
  495. clear what you need to type, but often it can be typed literally, e.g., with
  496. the ":map" command.  The rules are:
  497.  1.  Any printable characters are typed directly, except backslash and '<'
  498.  2.  A backslash is represented with "\\", double backslash, or "<Bslash>".
  499.  3.  A real '<' is represented with "\<" or "<lt>".  When there is no
  500.      confusion possible, a '<' can be used directly.
  501.  4.  "<key>" means the special key typed.  This is the notation explained in
  502.      the table above.  A few examples:
  503.        <Esc>        Escape key
  504.        <C-G>        CTRL-G
  505.        <Up>            cursor up key
  506.        <C-LeftMouse>    Control- left mouse click
  507.        <S-F11>        Shifted function key 11
  508.        <M-a>        Meta- a  ('a' with bit 8 set)
  509.        <M-A>        Meta- A  ('A' with bit 8 set)
  510.        <t_kd>        "kd" termcap entry (cursor down key)
  511.  
  512. If you want to use the full <> notation in Vim, you have to make sure the '<'
  513. flag is excluded from 'cpoptions' (when 'compatible' is not set, it already is
  514. by default). >
  515.     :set cpo-=<
  516. The <> notation uses <lt> to escape the special meaning of key names.  Using a
  517. backslash also works, but only when 'cpoptions' does not include the 'B' flag.
  518.  
  519. Examples for mapping CTRL-H to the six characters "<Home>": >
  520.     :imap <C-H> \<Home>
  521.     :imap <C-H> <lt>Home>
  522. The first one only works when the 'B' flag is not in 'cpoptions'.  The second
  523. one always works.
  524. To get a literal "<lt>" in a mapping: >
  525.     :map <C-L> <lt>lt>
  526.  
  527. For mapping, abbreviation and menu commands you can then copy-paste the
  528. examples and use them directly.  Or type them literally, including the '<' and
  529. '>' characters.  This does NOT work for other commands, like ":set" and
  530. ":autocmd"!
  531.  
  532. ==============================================================================
  533. 5. Modes, introduction                *vim-modes-intro* *vim-modes*
  534.  
  535. Vim has six BASIC modes:
  536.  
  537.                     *Normal* *Normal-mode* *command-mode*
  538. Normal mode        In Normal mode you can enter all the normal editor
  539.             commands.  If you start the editor you are in this
  540.             mode (unless you have set the 'insertmode' option,
  541.             see below).  This is also known as command mode.
  542.  
  543. Visual mode        This is like Normal mode, but the movement commands
  544.             extend a highlighted area.  When a non-movement
  545.             command is used, it is executed for the highlighted
  546.             area.  See |Visual-mode|.
  547.             If the 'showmode' option is on "-- VISUAL --" is shown
  548.             at the bottom of the window.
  549.  
  550. Select mode        This looks most like the MS-Windows selection mode.
  551.             Typing a printable character deletes the selection
  552.             and starts Insert mode.  See |Select-mode|.
  553.             If the 'showmode' option is on "-- SELECT --" is shown
  554.             at the bottom of the window.
  555.  
  556. Insert mode        In Insert mode the text you type is inserted into the
  557.             buffer.  See |Insert-mode|.
  558.             If the 'showmode' option is on "-- INSERT --" is shown
  559.             at the bottom of the window.
  560.  
  561. Command-line mode    In Command-line mode (also called Cmdline mode) you
  562. Cmdline mode        can enter one line of text at the bottom of the
  563.             window.  This is for the Ex commands, ":", the pattern
  564.             search commands, "?" and "/", and the filter command,
  565.             "!".  |Cmdline-mode|
  566.  
  567. Ex mode            Like Command-line mode, but after entering a command
  568.             you remain in Ex mode.  Very limited editing of the
  569.             command line.  |Ex-mode|
  570.  
  571. There are five ADDITIONAL modes.  These are variants of the BASIC modes:
  572.  
  573.                 *Operator-pending* *Operator-pending-mode*
  574. Operator-pending mode    This is like Normal mode, but after an operator
  575.             command has started, and Vim is waiting for a {motion}
  576.             to specify the text that the operator will work on.
  577.  
  578. Replace mode        Replace mode is a special case of Insert mode.  You
  579.             can do the same things as in Insert mode, but for
  580.             each character you enter, one character of the existing
  581.             text is deleted.  See |Replace-mode|.
  582.             If the 'showmode' option is on "-- REPLACE --" is
  583.             shown at the bottom of the window.
  584.  
  585. Insert Normal mode    Entered when CTRL-O given in Insert mode.  This is
  586.             like Normal mode, but after executing one command Vim
  587.             returns to Insert mode.
  588.             If the 'showmode' option is on "-- (insert) --" is
  589.             shown at the bottom of the window.
  590.  
  591. Insert Visual mode    Entered when starting a Visual selection from Insert
  592.             mode, e.g., by using CTRL-O and then "v", "V" or
  593.             CTRL-V.  When the Visual selection ends, Vim returns
  594.             to Insert mode.
  595.             If the 'showmode' option is on "-- (insert) VISUAL --"
  596.             is shown at the bottom of the window.
  597.  
  598. Insert Select mode    Entered when starting Select mode from Insert mode.
  599.             E.g., by dragging the mouse or <S-Right>.
  600.             When the Select mode ends, Vim returns to Insert mode.
  601.             If the 'showmode' option is on "-- (insert) SELECT --"
  602.             is shown at the bottom of the window.
  603.  
  604. ==============================================================================
  605. 6. Switching from mode to mode                *mode-switching*
  606.  
  607. If for any reason you do not know which mode you are in, you can always get
  608. back to Normal mode by typing <Esc> twice.  You will know you are back in
  609. Normal mode when you see the screen flash or hear the bell after you type
  610. <Esc>.  This doesn't work for Ex mode, use ":visual".
  611.  
  612.                             *i_esc*
  613.         TO mode                            ~
  614.         Normal    Visual    Select    Insert      Replace   Cmd-line  Ex ~
  615. FROM mode                                 ~
  616. Normal            v V ^V      *4     *1        R        : / ? !   Q
  617. Visual         *2          ^G     c C        --          :       --
  618. Select         *5    ^O ^G         *6        --          --      --
  619. Insert         <Esc>      --      --          <Insert>    --      --
  620. Replace         <Esc>      --      --    <Insert>          --      --
  621. Command-line     *3      --      --     :start        --              --
  622. Ex         :vi      --      --     --        --          --
  623.  
  624. -  NA
  625. -- not possible
  626.  
  627. *1 Go from Normal mode to Insert mode by giving the command "i", "I", "a",
  628.    "A", "o", "O", "c", "C", "s" or S".
  629. *2 Go from Visual mode to Normal mode by giving a non-movement command, which
  630.    causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V"
  631.    (see |v_v|), which just stops Visual mode without side effects.
  632. *3 Go from Command-line mode to Normal mode by:
  633.    - Hitting <CR> or <NL>, which causes the entered command to be executed.
  634.    - Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>.
  635.    - Hitting CTRL-C or <Esc>, which quits the command-line without executing
  636.      the command.
  637.    In the last case <Esc> may be the character defined with the 'wildchar'
  638.    option, in which case it will start command-line completion.  You can
  639.    ignore that and type <Esc> again.  {Vi: when hitting <Esc> the command-line
  640.    is executed.  This is unexpected for most people; therefore it was changed
  641.    in Vim.  But when the <Esc> is part of a mapping, the command-line is
  642.    executed.  If you want the Vi behaviour also when typing <Esc>, use ":cmap
  643.    ^V<Esc> ^V^M"}
  644. *4 Go from Normal to Select mode by:
  645.    - use the mouse to select text while 'selectmode' contains "mouse"
  646.    - use a non-printable command to move the cursor while keeping the Shift
  647.      key pressed, and the 'selectmode' option contains "key"
  648.    - use "v", "V" or "CTRL-V" while 'selectmode' contains "cmd"
  649.    - use "gh", "gH" or "g CTRL-H"  |g_CTRL-H|
  650. *5 Go from Select mode to Normal mode by using a non-printable command to move
  651.    the cursor, without keeping the Shift key pressed.
  652. *6 Go from Select mode to Insert mode by typing a printable character.  The
  653.    selection is deleted and the character is inserted.
  654.  
  655. If the 'insertmode' option is on, editing a file will start in Insert mode.
  656.  
  657.     *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N*
  658. Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to
  659. Normal mode from any other mode.  This can be used to make sure Vim is in
  660. Normal mode, without causing a beep like <Esc> would.
  661.  
  662.  
  663.                     *Q* *mode-Ex* *Ex-mode* *Ex* *EX*
  664. Q            Switch to "Ex" mode.  This is a bit like typing ":"
  665.             commands one after another, except:
  666.             - You don't have to keep pressing ":".
  667.             - The screen doesn't get updated after each command.
  668.             - There is no normal command-line editing.
  669.             - Mappings and abbreviations are not used.
  670.             In fact, you are editing the lines with the "standard"
  671.             line-input editing commands (<Del> or <BS> to erase,
  672.             CTRL-U to kill the whole line).
  673.             Vim will enter this mode by default if it's invoked as
  674.             "ex" on the command-line.
  675.             Use the ":vi" command |:visual| to exit "Ex" mode.
  676.             Note: In older versions of Vim "Q" formatted text,
  677.             that is now done with |gq|.
  678.  
  679.                     *gQ*
  680. gQ            Switch to "Ex" mode, but really behave like typing ":"
  681.             commands after another.  All command line editing,
  682.             completion etc. is available.
  683.             Use the ":vi" command |:visual| to exit "Ex" mode.
  684.             {not in Vi}
  685.  
  686. ==============================================================================
  687. 7. The window contents                    *window-contents*
  688.  
  689. In Normal mode and Insert/Replace mode the screen window will show the current
  690. contents of the buffer: What You See Is What You Get.  There are two
  691. exceptions:
  692. - When the 'cpoptions' option contains '$', and the change is within one line,
  693.   the text is not directly deleted, but a '$' is put at the last deleted
  694.   character.
  695. - When inserting text in one window, other windows on the same text are not
  696.   updated until the insert is finished.
  697. {Vi: The screen is not always updated on slow terminals}
  698.  
  699. Lines longer than the window width will wrap, unless the 'wrap' option is off
  700. (see below).  The 'linebreak' option can be set to wrap at a blank character.
  701.  
  702. If the window has room after the last line of the buffer, Vim will show '~' in
  703. the first column of the last lines in the window, like this: >
  704.  
  705.     some line
  706.     last line
  707.     ~ 
  708.     ~ 
  709.  
  710. Thus the '~' lines indicate that the end of the buffer was reached.
  711.  
  712. If the last line in a window doesn't fit, Vim will indicate this with a '@' in
  713. the first column of the last lines in the window, like this: >
  714.  
  715.     first line
  716.     second line
  717.     @
  718.     @
  719.  
  720. Thus the '@' lines indicate that there is a line that doesn't fit in the
  721. window.
  722.  
  723. When the "lastline" flag is present in the 'display' option, you will not see
  724. '@' characters at the left side of window.  If the last line doesn't fit
  725. completely, only the part that fits is shown, and the last three characters of
  726. the last line are replaced with "@@@", like this: >
  727.  
  728.     first line
  729.     second line
  730.     a very long line that d
  731.     oesn't fit in the wi@@@
  732.  
  733. If there is a single line that is too long to fit in the window, this is a
  734. special situation.  Vim will show only part of the line, around where the
  735. cursor is.  There are no special characters shown, so that you can edit all
  736. parts of this line.
  737. {Vi: gives an "internal error" on lines that do not fit in the window}
  738.  
  739. The '@' occasion in the 'highlight' option can be used to set special
  740. highlighting for the '@' and '~' characters.  This makes it possible to
  741. distinguish them from real characters in the buffer.
  742.  
  743. The 'showbreak' option contains the string to put in front of wrapped lines.
  744.  
  745.                             *wrap-off*
  746. If the 'wrap' option is off, long lines will not wrap.  Only the part that
  747. fits on the screen is shown.  If the cursor is moved to a part of the line
  748. that is not shown, the screen is scrolled horizontally.  The advantage of
  749. this method is that columns are shown as they are and lines that cannot fit
  750. on the screen can be edited.  The disadvantage is that you cannot see all the
  751. characters of a line at once.  The 'sidescroll' option can be set to the
  752. minimal number of columns to scroll.  {Vi: has no 'wrap' option}
  753.  
  754. All normal ASCII characters are displayed directly on the screen.  The <Tab>
  755. is replaced with the number of spaces that it represents.  Other non-printing
  756. characters are replaced with "^{char}", where {char} is the non-printing
  757. character with 64 added.  Thus character 7 (bell) will be shown as "^G".
  758. Characters between 127 and 160 are replaced with "~{char}", where {char} is
  759. the character with 64 subtracted.  These characters occupy more than one
  760. position on the screen.  The cursor can only be positioned on the first one.
  761.  
  762. If you set the 'number' option, all lines will be preceded with their
  763. number.  Tip: If you don't like wrapping lines to mix with the line numbers,
  764. set the 'showbreak' option to eight spaces:
  765.     ":set showbreak=\ \ \ \ \ \ \ \ "
  766.  
  767. If you set the 'list' option, <Tab> characters will not be shown as several
  768. spaces, but as "^I".  A '$' will be placed at the end of the line, so you can
  769. find trailing blanks.
  770.  
  771. In Command-line mode only the command-line itself is shown correctly.  The
  772. display of the buffer contents is updated as soon as you go back to Command
  773. mode.
  774.  
  775. The last line of the window is used for status and other messages.  The
  776. status messages will only be used if an option is on:
  777.  
  778. status message            option         default    Unix default    ~
  779. current mode            'showmode'    on        on
  780. command characters        'showcmd'    on        off
  781. cursor position            'ruler'        off        off
  782.  
  783. The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|.  The
  784. command characters are those that you typed but were not used yet.  {Vi: does
  785. not show the characters you typed or the cursor position}
  786.  
  787. If you have a slow terminal you can switch off the status messages to speed
  788. up editing:
  789.     :set nosc noru nosm
  790.  
  791. If there is an error, an error message will be shown for at least one second
  792. (in reverse video).  {Vi: error messages may be overwritten with other
  793. messages before you have a chance to read them}
  794.  
  795. Some commands show how many lines were affected.  Above which threshold this
  796. happens can be controlled with the 'report' option (default 2).
  797.  
  798. On the Amiga Vim will run in a CLI window.  The name Vim and the full name of
  799. the current file name will be shown in the title bar.  When the window is
  800. resized, Vim will automatically redraw the window.  You may make the window as
  801. small as you like, but if it gets too small not a single line will fit in it.
  802. Make it at least 40 characters wide to be able to read most messages on the
  803. last line.
  804.  
  805. On most Unix systems, resizing the window is recognized and handled correctly
  806. by Vim.  {Vi: not ok}
  807.  
  808. ==============================================================================
  809. 8. Definitions                        *definitions*
  810.  
  811.   screen        The whole area that Vim uses to work in.  This can be
  812.             a terminal emulator window.  Also called "the Vim
  813.             window".
  814.   window        A view on a buffer.
  815.  
  816. A screen contains one or more windows, separated by status lines and with the
  817. command line at the bottom.
  818.  
  819.     +-------------------------------+
  820. screen    | window 1    | window 2    |
  821.     |        |        |
  822.     |        |        |
  823.     |= status line =|= status line =|
  824.     | window 3            |
  825.     |                |
  826.     |                |
  827.     |==== status line ==============|
  828.     |command line            |
  829.     +-------------------------------+
  830.  
  831. The command line is also used for messages.  It scrolls up the screen when
  832. there is not enough room in the command line.
  833.  
  834. A difference is made between four types of lines:
  835.  
  836.   buffer lines        The lines in the buffer.  This is the same as the
  837.             lines as they are read from/written to a file.  They
  838.             can be thousands of characters long.
  839.   logical lines        The buffer lines with folding applied.  Buffer lines
  840.             in a closed fold are changed to a single logical line:
  841.             "+-- 99 lines folded".  They can be thousands of
  842.             characters long.
  843.   window lines        The lines displayed in a window: A range of logical
  844.             lines with wrapping, line breaks, etc.  applied.  They
  845.             can only be as long as the width of the window allows,
  846.             longer lines are wrapped or truncated.
  847.   screen lines        The lines of the screen that Vim uses.  Consists of
  848.             the window lines of all windows, with status lines
  849.             and the command line added.  They can only be as long
  850.             as the width of the screen allows.  When the command
  851.             line gets longer it wraps and lines are scrolled to
  852.             make room.
  853.  
  854. buffer lines    logical lines    window lines    screen lines ~
  855.  
  856. 1. one        1. one        1. +-- folded   1.  +-- folded
  857. 2. two        2. +-- folded    2. five        2.  five
  858. 3. three    3. five        3. six        3.  six
  859. 4. four        4. six        4. seven    4.  seven
  860. 5. five        5. seven            5.  === status line ===
  861. 6. six                        6.  aaa
  862. 7. seven                    7.  bbb
  863.                         8.  ccc ccc c
  864. 1. aaa        1. aaa        1. aaa        9.  cc
  865. 2. bbb        2. bbb        2. bbb        10. ddd
  866. 3. ccc ccc ccc    3. ccc ccc ccc    3. ccc ccc c    11. ~ 
  867. 4. ddd        4. ddd        4. cc        12. === status line ===
  868.                 5. ddd        13. (command line)
  869.                 6. ~ 
  870.  
  871. ==============================================================================
  872.  vim:tw=78:ts=8:ft=help:norl:
  873.